package com.jfinal.log;

/**
 * 升级log4j 1.x到2.x
 * @author jgl
 *
 */
public class Log4j2Log extends Log{
	
	private org.apache.logging.log4j.Logger log;
	
	Log4j2Log(Class<?> clazz){
		log = org.apache.logging.log4j.LogManager.getLogger(clazz);
	}
	
	Log4j2Log(String name) {
		log = org.apache.logging.log4j.LogManager.getLogger(name);
	}

	@Override
	public void info(String message) {
		log.info(message);
	}
	
	@Override
	public void info(String message, Throwable t) {
		log.info( message, t);
	}
	
	@Override
	public void debug(String message) {
		log.debug( message);
	}
	
	@Override
	public void debug(String message, Throwable t) {
		log.debug( message, t);
	}
	
	@Override
	public void warn(String message) {
		log.warn(message);
	}
	
	@Override
	public void warn(String message, Throwable t) {
		log.warn(message,t);
	}
	
	@Override
	public void error(String message) {
		log.error(message);
	}
	
	@Override
	public void error(String message, Throwable t) {
		log.error(message,t);
	}
	
	@Override
	public void fatal(String message) {
		log.fatal(message);
	}
	
	@Override
	public void fatal(String message, Throwable t) {
		log.fatal(message,t);
	}
	//增加Trace级别
	public void trace(String message) {
		log.trace(message);
	}
	
	public void trace(String message, Throwable t) {
		log.trace(message,t);
	}
	
	@Override
	public boolean isDebugEnabled() {
		return log.isDebugEnabled();
	}
	
	@Override
	public boolean isInfoEnabled() {
		return log.isInfoEnabled();
	}
	
	@Override
	public boolean isWarnEnabled() {
		return log.isWarnEnabled();
	}
	
	@Override
	public boolean isErrorEnabled() {
		return log.isErrorEnabled();
	}
	
	@Override
	public boolean isFatalEnabled() {
		return log.isFatalEnabled();
	}
	
	public boolean isTraceEnabled(){
		return log.isTraceEnabled();
	}

}
